<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api\v1\UploadController;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
/*
Route::prefix('v1')->name('api.v1.')->middleware(['throttle:3,1'])->namespace('Api\v1')->group(function () {
    Route::post('test-ip', 'TestController@testIp')->name('test.test');
});

Route::prefix('v1')->name('api.v1.')->middleware(['change-locale'])->namespace('Api\v1')->group(function () {

});
*/

Route::prefix('v1')->name('api.v1.')->namespace('Api\v1')->middleware(['change-locale'])->group(function () {

    //68Pay
    Route::post('exbaba_recharge', 'Pay\ExbabaPayController@rechargeNotify');
    Route::post('exbaba_withdrawal', 'Pay\ExbabaPayController@withdrawalNotify');

    //tarspay
    Route::post('tars_recharge', 'Pay\TarsPayController@rechargeNotify');
    Route::post('tars_withdrawal', 'Pay\TarsPayController@withdrawalNotify');

    //betcat
    Route::post('betcat_recharge', 'Pay\BetcatPayController@rechargeNotify');
    Route::post('betcat_withdrawal', 'Pay\BetcatPayController@withdrawalNotify');

    //sun
    Route::post('sun_recharge', 'Pay\SunPayController@rechargeNotify');
    Route::post('sun_withdrawal', 'Pay\SunPayController@withdrawalNotify');

    //DGPAY
    Route::post('dg_recharge', 'Pay\DgPayController@rechargeNotify');
    Route::post('dg_withdrawal', 'Pay\DgPayController@withdrawalNotify');

    //测试
    Route::post('test', 'TestController@test')->name('test.test');
    //Route::get('apis', 'ApiController@lists')->name('api.lists');

    Route::middleware(['normalizePageAndPerPage'])->group(function () {
        Route::post('upload/image', [UploadController::class, 'image']);
        //可用银行列表
        Route::get('banks', 'CardController@bank')->name('card.bank');
        //可用支付通道列表
        Route::get('payments', 'PaymentThirdPayController@index')->name('payment.index');

        Route::middleware(['api-check-sign'])->group(function () {

            //用户
            Route::middleware(['tikshop-login'])->group(function () {
                //会员信息
                Route::get('me', 'UserController@me');
                //会员信息-钱包
                Route::get('wallet', 'UserController@wallet');
                //修改用户信息(头像)
                Route::patch('user', 'UserController@update')->name('user.update');
                //修改支付密码
                Route::put('pay_password_byold', 'UserController@changePayPasswordByold')->name('user.changePayPasswordByold');
                //银行卡 UPI
                Route::resource('cards', 'CardController')->only('index', 'store');
                Route::post('cards/edit', 'CardController@editcards');
                //银行卡详情
                Route::get('cards/show', 'CardController@list');

                //会员信息-消息
                Route::get('user/messages', 'UserController@messages');
                Route::patch('user/messages/{id}', 'UserController@messagesUpdate');

                //充值
                Route::resource('recharges', 'RechargeController')->only(['index', 'store', 'update']);
                Route::post('recharges/other', 'RechargeController@other');
                Route::post('recharges/othercode', 'RechargeController@otherCode');
                Route::get('recharges/{id}', 'RechargeController@show');

                // 收入支出
                Route::get('accounts', 'AccountController@index')->name('account.index');
                //收入支出类型
                Route::get('accounts/type', 'AccountController@type')->name('account.type');

                //店铺统计
                Route::get('shop/statistics', 'ShopController@statistics');

                //提现
                Route::resource('withdrawals', 'WithdrawalController')->only(['index', 'store']);

                //商品分类
                Route::get('goods_category', 'Goods\CategoryController@index');
                //商品列表
                Route::get('goods/list', 'Goods\GoodsController@goodsList');
                //商品添加橱窗
                Route::post('shopwindow', 'Goods\GoodsController@shopwindowStore');
                //橱窗商品列表
                Route::get('shopwindow', 'Goods\GoodsController@shopwindowGet');
                //橱窗商品修改
                Route::patch('shopwindow', 'Goods\GoodsController@shopwindowUpdate');
                //推广商品列表
                Route::get('adgoods', 'Goods\GoodsController@shopGoodsAdGet');


                //商品订单列表
                Route::get('order/list', 'GoodsOrderController@orderList');
                //商品订单支付
                Route::post('order/payment', 'GoodsOrderController@payment');

                // 文章
                Route::get('articles', 'ArticleController@index');
                Route::get('article', 'ArticleController@show');
                //客服,废弃
                //Route::get('salesaman', 'SalesmanResource.php@getSalesaman')->name('Salesman.getSalesaman');
                //投诉举报
                Route::post('complaints', 'ComplaintController@store')->name('complaint.store');
                //轮播
                Route::resource('banner', 'BannerController')->only(['index']);

                //推广配置
                Route::get('adsconfig', 'AdsController@config');
                //推广订单创建
                Route::post('ads', 'AdsController@store');

                //优惠卷列表
                Route::get('mycoupons', 'CouponController@mycoupons');
                //推广订单创建
                Route::post('coupon', 'CouponController@store');

            });


            //店铺
            Route::get('shop/shop', 'UserController@shop');
            //商品分类
            Route::get('shop/goods_category', 'Goods\CategoryController@shop');
            //商品列表
            Route::get('shop/goods/list', 'Goods\GoodsController@shopGoodsList');
            //首页商品列表
            Route::get('shop/goods/index', 'Goods\GoodsController@shopGoodsIndex');
            //推广商品列表
            Route::get('shop/goods/adgoods', 'Goods\GoodsController@shopGoodsAdlist');
            //商品详情
            Route::get('shop/goods/detail', 'Goods\GoodsController@shopDetail');




        });
    });



});

//后台使用的接口
Route::prefix('v1')->name('api.v1.')->namespace('Api\v1')->group(function () {
    //获取会员列表
    Route::get('getuser', 'UserController@getuser');
    //会员已上架橱窗商品
    Route::get('user/shopwindow', 'Goods\GoodsController@userShopwindow');
    //生成商品订单
    Route::post('goodsorder/create', 'GoodsOrderController@store');




});



//APP使用的接口
Route::prefix('v1')->name('api.v1.')->namespace('Api\v1')->middleware(['change-locale'])->group(function () {
    Route::get('links', 'HomeController@links');


});
